﻿<Window x:Class="LayeredArchitectureSample.ClientBrowser.TripsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        Height="600" Width="550"
        Title="Trips" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" ResizeMode="NoResize">
    <StackPanel>
        <ListView x:Name="TripsListView" ItemsSource="{Binding Path=Trips}" SelectionMode="Single" SelectedItem="{Binding Path=CurrentlySelectedTrip}" Height="500" Width="500" MaxWidth="500" MaxHeight="500" VerticalAlignment="Top">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Route" DisplayMemberBinding="{Binding Path=Route.AsText}"></GridViewColumn>
                    <GridViewColumn Header="Status" DisplayMemberBinding="{Binding Path=Status}"></GridViewColumn>
                    <GridViewColumn Header="Wares">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Expander Header="Click to see the wares">
                                    <ScrollViewer MaxHeight="150" MaxWidth="150">
                                        <ListView ItemsSource="{Binding Path=Wares}">
                                            <ListView.View>
                                                <GridView>
                                                    <GridViewColumn Header="Ware" DisplayMemberBinding="{Binding Path=Ware.Code}"></GridViewColumn>
                                                    <GridViewColumn Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"></GridViewColumn>
                                                </GridView>
                                            </ListView.View>
                                        </ListView>
                                    </ScrollViewer>
                                </Expander>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        <StackPanel Orientation="Horizontal" Margin="10" HorizontalAlignment="Center">
            <Button Content="Create a trip and ship it to random location" Click="ShipNewTripButtonClick" Margin="20,0,0,0"></Button>
            <Button Content="Mark as arrived" IsEnabled="{Binding Path=CanMarkSelectedTripAsArrived}" Click="MarkTripArrivalButtonClick" Margin="20,0,0,0"></Button>
        </StackPanel>
        <Button x:Name="CloseButton" Content="Close the window" HorizontalAlignment="Center" Click="CloseDownButtonClick"></Button>
    </StackPanel>
</Window>